package com.ruoyi.aitcommon.api;

import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.aitcommon.anotation.ApiLog;
import com.ruoyi.aitcommon.config.ConfigManager;
import com.ruoyi.aitcommon.utils.ExceptionUtils;
import com.ruoyi.aitcommon.utils.JSONResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/token/common/dboper")
public class DBOperaionToken {
    @Autowired
    DBOperation dbOperation;
    @Autowired
    ConfigManager configManager;

    /**
     * 直接调用dbOperation.AITQuery(jsonstr)
     * 增加了token验证
     *
     * @param jsonstr
     * @return
     * @throws Exception
     */
    @ApiLog("AIT通用查询接口")
    @PostMapping("/AITQuery")
    public JSONObject AITQuery(@RequestBody String jsonstr) throws Exception {
        try{
            //调用查询返回
            return dbOperation.AITQuery(jsonstr);
        }catch (Exception ex){
            return JSONResult.error(ex.getMessage());
        }

    }
}
